<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020-02-22
 * Time: 15:41
 */
namespace app\cms\model;
use think\Model;
class Newsclass extends Model
{
    protected $name = "cms_newsclass";

    // 定义自动完成的属性
    protected $insert = ['status' => 1];

    // status属性读取器
    protected function getStatusAttr($value)
    {
        $status = [0 => '关闭', 1 => '开启'];
        return $status[$value];
    }

    // 定义关联方法
    public function pclasses()
    {
        // 用户HAS ONE档案关联
        return $this->hasOne('Newsclass','pid','id');
    }

}